跳到主要内容

Multi Purchase

Overview:

In Unity, you only need to call this method to pay and the payment type will depend on the DzoSDK server.

In Unity, follow these steps.

Step 1: Regist callback (1 time only)

    SDKAPI.multiPurchaseCallBack += (_result)=>{
Debug.Log(">>> MultiPurchase callback --- status: " + _result.status + " | errorCode: " + _result.errorCode + " | typePurchase: " + _result.typeMultiPurchase + " | money: " + _result.money + " | transactionID: " + _result.transactionID + " | sku: " + _result.sku + " | itemID: " + _result.itemID + " | roleID: " + _result.roleID + " | gameTransaction: " + _result.gameTransaction + " | lastHashID: " + _result.lastHashID + " | msg: " + _result.msg);
};

Step 2: Call method MultiPurchase

Method:

    public static void MultiPurchase(string _sku, string _itemID, string _roleID, string _gameTransaction)

Example:

    
string _sku= "dzo_20k_vnd";
string _itemID = "item01"; // OPTIONAL
string _roleID = "user123456";
string _gameTransaction = "1234567"; // OPTIONAL
SDKAPI.MultiPurchase(_sku, _itemID, _roleID, _gameTransaction);

TypeParameter NameTypeDescription
InputskustringStock Keeping Unit of this item.
Ex: “vn.dzogame.ts_sku_gold01”
itemIDstringID of Item in your game.
Ex: “sword01”
roleIDstringUserID in in game.
Ex: “User123456”
gameTransactionstringOrder code, transaction from the game.
Ex: “10938093890130192830”
ResulttypeMultiPurchaseint0: NOT_DEFINE
1: INAPP_PURCHASE
2: SCORE_PURCHASE
3: DZOVI_PURCHASE
statusint0: Success
-999: Process To Server SDK Error
-997: Check Logic Error
-996: Purchase Failed
-99: Type In-App Purchase - Process To Store Error
-98: Type In-App Purchase - Success_Payment_OtherAccount,
-97: Type In-App Purchase - User Canceled
errorCodeintError code
msgstringMessage result payment
dzoOrderIdstringDzo order ID
moneystringPrice of item
gameTransactionstringOrder code, transaction from the game.
Ex: “10938093890130192830”
transactionIDstringPurchase Transaction ID
skustringStock Keeping Unit of this item
itemIDstringID of Item in your game.
Ex: “sword01”
roleIDstringUserID in in game.
Ex: “User123456”
lastHashIDstringLast hashID
Ex: “Dzo.123456789”